#ifndef __MACRO_H__
#define __MACRO_H__

#include "Edit.h"
#include "WidgetWin.h"
#include "RootView.h"
#include "res.h"
#include "Utility.h"

#ifndef ERR_PRINTF
#define ERR_PRINTF(format, ...) \
{ \
char szBuff[1024] = {0}; \
Edit* edit = reinterpret_cast<Edit *>(WidgetWin::getInstance().getRootView()->getViewById(ID_EDIT_LOG)); \
if (edit) \
{ \
sprintf(szBuff, "[ERR] " format, __VA_ARGS__); \
edit->appendText(StringToWstring(std::string(szBuff))); \
} \
}
#endif

#ifndef MSG_PRINTF
#define MSG_PRINTF(format, ...)\
{ \
char szBuff[1024] = {0}; \
Edit* edit = reinterpret_cast<Edit *>(WidgetWin::getInstance().getRootView()->getViewById(ID_EDIT_LOG)); \
if (edit) \
{ \
sprintf(szBuff, "[MSG] " format, __VA_ARGS__); \
edit->appendText(StringToWstring(std::string(szBuff))); \
} \
}

#endif

#ifdef _DEBUG
#define DBG_PRINTF printf
#else
#define DBG_PRINTF
#endif


#endif